import Vue from 'vue'
import VueRouter from 'vue-router'
import BookDetail from '@/views/BookDetail.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  },
  {
    path: '/',
    name: 'Home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/market',
    name: 'BookMarket',
    component: () => import('../views/headerviews/BookMarket.vue')
  },
  {
    path: '/my-posts',
    name: 'MyPosts',
    component: () => import('../views/headerviews/MyPosts.vue')
  },
  {
    path: '/messages',
    name: 'Messages',
    component: () => import('../views/headerviews/Messages.vue')
  },
  {
    path: '/profile',
    name: 'Profile',
    component: () => import('../views/headerviews/Profile.vue')
  },
  {
    path: '/book/:id',
    name: 'BookDetail',
    component: BookDetail
  }
]

const router = new VueRouter({
  routes
})

export default router